#include "ns.h"

extern union Nsipc nsipcbuf;

void
output(envid_t ns_envid)
{
	binaryname = "ns_output";

	// LAB 6: Your code here:
	// 	- read a packet from the network server
	//	- send the packet to the device driver
	while(1)
    {
        cprintf("ns output\n");
        ipc_recv(NULL, &nsipcbuf, NULL );
        cprintf("shit");
        if(env->env_ipc_from != ns_envid || env->env_ipc_value != NSREQ_OUTPUT)
            continue;
        sys_e100_send(nsipcbuf.pkt.jp_data, nsipcbuf.pkt.jp_len);
    }
}
